package com.todo.content.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/3/19 20:07
 * @description
 */
@Getter
@AllArgsConstructor
public enum TopicTypeEnum {

    FRIEND(1, "FRIEND", "交友"),
    TRIP(2, "TRIP", "出行"),
    FOOT(3, "FOOT", "徒步"),
    CLIMB(4, "CLIMB", "登山"),
    TRAVEL_AROUND(5, "TRAVEL_AROUND", "周边游"),
    FAMILY_TRAVEL(6, "FAMILY_TRAVEL", "亲子游"),
    DAILY(7, "DAILY", "日常分享"),

    ;

    private static Map<Integer, TopicTypeEnum> typeMap = Arrays
            .stream(TopicTypeEnum.values())
            .collect(Collectors.toMap(TopicTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static TopicTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
